/*
 * Copyright (c) 2024. Shanghai HEADING information Engineering Co., Ltd. All rights reserved.
 */
package com.lovely602.design.study.basic;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author lizhixing
 */
public class InetAddressTest {

  public static void main(String[] args) throws UnknownHostException {

    InetAddress localHost = InetAddress.getLocalHost();
    System.out.println("localHost：" + localHost);
    InetAddress inetAddress = InetAddress.getByName("www.baidu.com");
    System.out.println("www.baidu.com：" + inetAddress);
    InetAddress[] inetAddresses = InetAddress.getAllByName("www.microsoft.com");
    for (InetAddress inetAddress1 : inetAddresses) {
      System.out.println("www.microsoft.com：" + inetAddress1);
    }
  }

}
